//- 产品浏览记录
mixin history
	//- 正在访问的该产品不显示
	nav.list.mtop30(ng-controller='App.HistoryCtrl', ng-show='history.length>1')
		h4.head.nomp.cd
			a(href='#', onclick='return false', ng-click='clear()').pull-right.mrem.nor
				small 清空
			| 浏览过的商品
		
		.item(ng-repeat="h in history.slice(1)", ng-class='{last: $last}',
				ng-init='hover=false',
				ng-mouseover='hover=true',
				ng-mouseleave='hover=false')
				
			a.buy(ng-show='hover && !h.cannot', href='javascript:;', ng-click='purchase(h.product_id, h.period, h.count, h.payment_type)') 购买
			a.nfc(gf-href='#/{{h.product_type}}/detail?pid={{h.id}}', title='{{h.title}}') {{h.title}}
			br
			span.afc(ng-bind-html-unsafe='h.price')
			
			img(src="img/blank.gif", gf-src='/_image/pdt_{{h.product_type}}_{{h.id}}_small', gf-bg);
			//-.btns
			//-	button.btn.mtop10(ng-click='addToCart({product_id: h.id, period: period.period, count: number, payment_type: paymentType}, added)') 加入购物车
			
//- 热销产品
mixin hottest
	nav.list(ng-controller='App.HotCtrl', ng-show='hot.items.length')
		h4.head.nomp.cd 热卖产品
		
		.item(ng-repeat='h in hot.items', ng-class='{last: $last}', 
				ng-show='hot.items.length', 
				ng-init='hover=false',
				ng-mouseover='hover=true',
				ng-mouseleave='hover=false')
			//- 0  :只能前端支付 1 ：只能后端支付 2 ：可以选
			//- 默认为前端
			//- 服务产品没有 extra.charge_type
			a.buy(ng-show='hover && !h.offline && !(h.hot < 0)', href='javascript:;', ng-click='purchase(h.id, h.pricing[0].period||1, h.extra.min_amount||1, h.extra.charge_type||0)') 购买
			
			div(ng-switch='h.product_type')
				div(ng-switch-when='fund')
					a.nfc(gf-href='#/{{h.product_type}}/detail?pid={{h.id}}', title='{{h.title}}') {{h.title}}
					br
					span.afc 净值：{{(h.pricing[0].period | number : 4) || '--'}}元
				div(ng-switch-when='money')
					a.nfc(gf-href='#/asset/detail?pid={{h.id}}', title='{{h.title}}') {{h.title}}
					br
					span.afc(ng-switch='!h.extra2.yjbjjz')
						span(ng-switch-when='true', ng-switch='h.code')
							span(ng-switch-when="873001", ng-show='h.extra2.latest_netval[0].cumulate_net_value')
								| 预期年化收益{{h.extra2.latest_netval[0].cumulate_net_value | percentage : 2}}
							span(ng-switch-when="878001")
								| 3X沪深300或创业板指
							span(ng-switch-default)
								| 今年收益{{shouyi(h) | percentage : 2}}

						span(ng-switch-when='false')
							| 预期年化收益{{h.extra2.yjbjjz | percentage : 2}}

				div(ng-switch-when='service')
					a.nfc(gf-href='#/{{h.product_type}}/detail?pid={{h.id}}', title='{{h.title}}') {{h.title}}
					br
					span.afc ￥{{h.pricing[0].price}}元/{{periodLabel[h.pricing[0].period]}}
			
			img(src="img/blank.gif", gf-src='/_image/pdt_{{h.product_type}}_{{h.id}}_small', gf-bg);
//- 分页
mixin pager
	.pagination.mtop20
		span 共&nbsp;{{pageCount}}&nbsp;页
		a(href='#', onclick='return false;', rel='first', ng-click='gotoPage(1)', ng-show='page>1') 第一页
		a(href='#', onclick='return false;', rel='prev', ng-click='gotoPage(page-1)', ng-show='page>1') 上一页
		a(href='#', onclick='return false;', ng-click='gotoPage(page-3)', ng-show='page-3>0') {{page-3}}
		a(href='#', onclick='return false;', ng-click='gotoPage(page-2)', ng-show='page-2>0') {{page-2}}
		a(href='#', onclick='return false;', ng-click='gotoPage(page-1)', ng-show='page-1>0') {{page-1}}
		strong(ng-show='page-1>0') {{page}}
		a(href='#', onclick='return false;', ng-click='gotoPage(page+1)', ng-show='page+1<=pageCount') {{page+1}}
		a(href='#', onclick='return false;', ng-click='gotoPage(page+2)', ng-show='page+2<=pageCount') {{page+2}}
		a(href='#', onclick='return false;', ng-click='gotoPage(page+3)', ng-show='page+3<=pageCount') {{page+3}}
		a(href='#', onclick='return false;', rel='next', ng-click='gotoPage(page+1)', ng-show='page<pageCount') 下一页
		a(href='#', onclick='return false;', rel='last', ng-click='gotoPage(pageCount)', ng-show='page<pageCount') 最后一页

mixin pagerSypz
	.pagination.mtop20
		span 共&nbsp;{{pageCountSypz}}&nbsp;页
		a(href='#', onclick='return false;', rel='first', ng-click='gotoPageSypz(1)', ng-show='pageSypz>1') 第一页
		a(href='#', onclick='return false;', rel='prev', ng-click='gotoPageSypz(pageSypz-1)', ng-show='pageSypz>1') 上一页
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz-3)', ng-show='pageSypz-3>0') {{pageSypz-3}}
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz-2)', ng-show='pageSypz-2>0') {{pageSypz-2}}
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz-1)', ng-show='pageSypz-1>0') {{pageSypz-1}}
		strong(ng-show='pageSypz-1>0') {{pageSypz}}
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz+1)', ng-show='pageSypz+1<=pageCountSypz') {{pageSypz+1}}
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz+2)', ng-show='pageSypz+2<=pageCountSypz') {{pageSypz+2}}
		a(href='#', onclick='return false;', ng-click='gotoPageSypz(pageSypz+3)', ng-show='pageSypz+3<=pageCountSypz') {{pageSypz+3}}
		a(href='#', onclick='return false;', rel='next', ng-click='gotoPageSypz(pageSypz+1)', ng-show='pageSypz<pageCountSypz') 下一页
		a(href='#', onclick='return false;', rel='last', ng-click='gotoPageSypz(pageCountSypz)', ng-show='pageSypz<pageCountSypz') 最后一页

mixin dialog
	div(ng-switch='dialog', ng-show='online')
		.dialog(ng-switch-when='true', ng-controller='App.DialogController').border
			.close(ng-click='close()') &nbsp;
			.title.font16 提交购买信息
			.pad15
				.pad30.nc(ng-show='dialogState.value==1') 
					.alert.pull-left.mrem
					span.font14 提交成功，我们的顾问将与您取得联系，感谢您的信任！
					.mtop30.tac
						button.btn.primary(ng-click='close()') 确定
				div(ng-hide='dialogState.value==1')
					.mbottom20.nc.font14 我们将对您的信息严格保密，您的信息将不会被用于其它任何用途。
					form(name='dform', ng-submit='submit()')
						.mbottom20
							label(for='dialog_id_1').w5em 
								span.red *
								| 姓名
							input(id='dialog_id_1', gf-input, name='fullname', ng-model='param.fullname', required).text
							.yes(ng-show='param_fullnameError==2')
							.no(ng-show='param_fullnameError==1')
						.mbottom20
							label(for='dialog_id_2').w5em 
								span.red *
								| 手机号
							input(id='dialog_id_2', gf-input, name='mobile', ng-model='param.mobile', required).text
							.yes(ng-show='param_mobileError==2')
							.no(ng-show='param_mobileError==1')
							
						.mbottom30
							label.w5em &nbsp;
							input(type='submit', value='提交', ng-disabled='!dform.$valid').btn.primary.minor
							span(ng-show='error').nc {{error}}

//登录框
//-mixin loginDialog
	#loginDialog(ng-show='login.status', gf-remove-class='hidden', defer=400).hidden
		.gf-mask
		.dialog3.loginDialog.gf-dialog(fixed=1)
			.dialog-close.ib(ng-click='login.status=0')
			.dialog-title
				span.font18.mleft20 登录
			.loginDlgPanel.yui3-g.mtop40
				.yui3-u
					.bright
						.loginTitlePanel.mbottom20(ng-controller='App.LoginTypeCtrl')
							.yui3-g
								.yui3-u-1-2.tabButton.tac.vam.font14.cp(ng-class='{tabButton2: logintype==1}', ng-click='$parent.logintype=1') 广发通
								.yui3-u-1-2.tabButton.tac.vam.font14.cp(ng-class='{tabButton2: logintype==2}', ng-click='$parent.logintype=2') 交易账户

						.loginFormPanel(ng-switch='logintype')
							iframe.hideiframe(src='blank.html', name='loginiframe')
							mixin gft
							mixin jyzh
						
				.yui3-u
					.loginWidgetPanel
						div
							img(src='img/login_widget.gif')
						div
							a(href='http://www.gf.com.cn/yykh/yuyue.jsp', target='_blank').yysmkh.tac.vam
								.icon.yysmkh-icon.ib.vam.mright8
								.ib.vam 预约上门开户
						.mtop15.tar
							a(href='http://www.gf.com.cn/yykh/index.jsp', target='_blank').link 更多开户方式>>


//登录框(2014-09-24)
mixin loginDialog
	#loginDialog(ng-show='login.status', gf-remove-class='hidden', defer=400, ng-class="{saleMethodType: login.type==1}").hidden
		.gf-mask
		.dialog3.loginDialog.gf-dialog.loginDialogNew(fixed=1)
			.dialog-close.ib(ng-click='login.status=0;')
			.loginDlgPanel
				a.open-account(ng-show='login.type==0', href='#/account', title='立即前往开户页面', ng-click='login.status=0') 我要开户
				a.open-account(ng-show='login.type==1', href="https://account.gf.com.cn/", target="_blank", title="立即前往开户页面") 我要开户

				h2.loginDlgHeader 用户登录
				.loginFormPanel
					+loginform('loginform')

mixin loginform(name)
	iframe.hideiframe(src='blank.html', name='#{name}iframe')
	form(id=name,
			name=name,
			action='{{form.login_uri}}',
			ng-controller='App.LoginCtrl',
			target='#{name}iframe',
			method='POST',
			gf-submit='startOff',
			ng-init='__tabindex=0')

		.nc.b
			span.vam.mleft5(ng-bind='error')
			| &nbsp;
		input(type='hidden', name='error_url', gf-value="{{path}}")
		input(type='hidden', name='login_type', id="login_type")
		.textfield(ng-class='{blurbd: __tabindex==1}')
			.ib.uname-icon(ng-class='{"focus-cls": __tabindex==1}')
			label(for='newlogin_username', ng-hide='username.length') 手机号/邮箱/用户名/客户编号
			input(gf-focus='__tabindex=1;', gf-blur='__tabindex=0', type='text', id='newlogin_username', name='user_id', ng-model='username', required, tabindex=1)
		.textfield(ng-class='{blurbd: __tabindex==2}')
			.ib.upass-icon(ng-class='{"focus-cls": __tabindex==2}')
			label(for='newlogin_password', ng-hide='password.length') 密码
			input(type="hidden", name="mac", value="unknown")
			input(type="hidden", name="disknum", value="unknown")
			input(gf-focus='__tabindex=2;', gf-blur='__tabindex=0', type='password', id='newlogin_password', name='password', ng-model='password', required, tabindex=2)
		div
			.ib.textfield(style='width: 200px;', ng-class='{blurbd: __tabindex==3}')
				.ib.vcard-icon(ng-class='{"focus-cls": __tabindex==3}')
				label(style='width: 150px;', for='newlogin_verify', ng-hide='verify.length') 验证码
				input(gf-focus='__tabindex=3;', gf-blur='__tabindex=0', style='width: 150px;', type='text', id='newlogin_verify', name='ticket', ng-model='verify', maxlength=4, required, tabindex=3)
			.ib.mleft8
				img(ng-src='{{captcha_uri}}', alt='验证码', height=34, width=80)
				br
				a(href='#',onclick="return false;", ng-click='refresh()').kbqc 看不清楚
		.mtop10(style='width:290px')
			span.pull-right 您还不是广发通用户？
				a.link(href='#/register', ng-click='login.status = 0') 立即注册>>
			a.link(href='#/pwdreset', ng-click='login.status = 0') 忘记密码

		input(ng-hide='signing', type='submit', value='登 录', ng-disabled='!loginform.$valid', tabindex=4).login-button.mtop10

		.signing(ng-class='{hidden: !signing}')

//分页
mixin paging(obj, fn)
	.pagination2.mtop20
		.ib.firstPage.mright20.cp(ng-show='#{obj}.pageNum>1', ng-click='#{fn}(1)')
		.ib.prevPage.mright20.cp(ng-show='#{obj}.pageNum>1', ng-click='#{fn}(#{obj}.pageNum - 1)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum > 3', ng-bind='#{obj}.pageNum - 3', ng-click='#{fn}(#{obj}.pageNum - 3)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum > 2', ng-bind='#{obj}.pageNum - 2', ng-click='#{fn}(#{obj}.pageNum - 2)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum > 1', ng-bind='#{obj}.pageNum - 1', ng-click='#{fn}(#{obj}.pageNum - 1)')
		.ib.bc.tac.pageNum.currentPageNum.cp(ng-show='#{obj}.pageNum', ng-bind='#{obj}.pageNum', ng-click='#{fn}(#{obj}.pageNum)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum + 1 <= #{obj}.pageCount', ng-bind='#{obj}.pageNum + 1', ng-click='#{fn}(#{obj}.pageNum + 1)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum + 2 <= #{obj}.pageCount', ng-bind='#{obj}.pageNum + 2', ng-click='#{fn}(#{obj}.pageNum + 2)')
		.ib.bc.tac.pageNum.cp(ng-show='#{obj}.pageNum + 3 <= #{obj}.pageCount', ng-bind='#{obj}.pageNum + 3', ng-click='#{fn}(#{obj}.pageNum + 3)')
		.ib.nextPage.mleft20.mright20.cp(ng-show='#{obj}.pageNum<#{obj}.pageCount', ng-click='#{fn}(#{obj}.pageNum + 1)')
		.ib.lastPage.mright20.cp(ng-show='#{obj}.pageNum<#{obj}.pageCount', ng-click='#{fn}(#{obj}.pageCount)')
		span.mleft30 共&nbsp;{{#{obj}.pageCount}}&nbsp;页

//交易密码输入框
mixin tradePassword
	#tradePassword.hidden(ng-controller='App.TradePassword', ng-hide='tradePassword.closed', gf-remove-class='hidden', defer=400)
		.gf-mask
		.dialog3.border.pwd.none.gf-dialog(style="z-index: 15000;width: 455px;height: 234px;position: fixed;", fixed=1)
			.dialog-close(ng-click='close();') &nbsp;
			.dialog-title.font16.padleft15 交易密码
			.mleft40.mtop25
				.mbottom20.font12.nfc 请输入您的交易密码
				form(ng-submit="submit()")
					div
						span.vam.mrem2.pull-left.mtop10.b 密码:
						span.vam(gf-sec-pwd="tradePassword.password", width="200", height="32")
					div.mleft50
						.nc.padbottom10.hidden(ng-show='tradePassword.error', gf-remove-class='hidden', defer=400)
							img(src="img/alert3.gif")
							span.mleft5(ng-bind='tradePassword.error')
						.pad8.hidden(ng-hide='tradePassword.error', gf-remove-class='hidden', defer=400)
						input.btn.primary.font12(type="submit", value="提 交")

//风险提示
mixin riskTip
	#riskTipDialog.dialog.border.gf-dialog.hidden.riskLevelDialog.g(fixed=1, ng-show='dialog.RiskTip', gf-remove-class='hidden', ng-controller='App.RiskTip')
		.close(ng-click='close();', title='关闭') &nbsp;
		.title.font16 风险提示
		.pad15
			.bc 根据您所填写的我司《投资者风险承受能力调查与评估问卷》，您的风险属性类型评估结果为“{{riskLevelLabels[userFxdj]}}”，鉴于您所购买的产品风险级别高于您的风险承受能力，请您充分了解自身风险承受能力水平及产品风险属性，自主决策是否参与产品定制。
			.mtop20.padbottom15.tal
				button(ng-click='submit();', ng-disabled='online && !accepted').btn.primary.pull-right 去结算
				label.nc
					input(type='checkbox', ng-model='accepted').checkbox
					| &nbsp;清楚风险匹配结果，确认继续购买

//提建议
mixin suggestion
	#suggestion_dialog.hidden(ng-show='opened', gf-remove-class='hidden', defer=400, ng-controller='App.SuggestionCtrl')
		.gf-mask
		div(ng-switch='!success')
			.dialog3.suggestion_dialog.gf-dialog(ng-switch-when='true', fixed=1)
				.dialog-close.ib(ng-click='$parent.opened=false;$parent.success=false;')
				.dialog-title
					span.font18.mleft20 我要提建议
				form.container(onsubmit='return false;')
					.suggestion-title
						label 标题：
						input(ng-model='data.title.value', get-val='data.title.getValue', gf-placeholder='请输入4～30个字符', autocomplete='off')
						| &nbsp;&nbsp;
						.error-message(ng-show='data.title.error', ng-bind='data.title.error')

					.suggestion-content
						label 内容：
						textarea(ng-model='data.content.value', get-val='data.content.getValue', gf-placeholder='感谢您给我们提出建议。我们将认真考虑并采纳您提出的合理建议，并不断提升我们的产品体验。')
					.mleft50.error-message.padbottom10(ng-show='data.content.error', ng-bind='data.content.error')
					.suggestion-captcha(ng-init='ramdom=0;data.captcha={}')
						input(ng-model='data.captcha.value', placeholder='验证码')
						| &nbsp;&nbsp;
						img#captcha_img(ng-src='/captcha2.jpg?_cache_={{ramdom}}', alt='验证码', height=30, width=100, ng-click='ramdom=ramdom+1')
						| &nbsp;&nbsp;
						.error-message(ng-show='data.captcha.error', ng-bind='data.captcha.error') 验证码错误

					.suggestion-button
						button.comment-btn(type='submit', ng-click='submit()') 发&nbsp;表
						button.reset-btn(ng-click='data={}') 重&nbsp;置
						| &nbsp;&nbsp;

			.dialog3.suggestion_dialog_success.gf-dialog(ng-switch-when='false', fixed=1)
				.dialog-close.ib(ng-click='$parent.opened=false;$parent.success=false;')
				.dialog-title
					span.font18.mleft20 我要提建议
				.container
					.qtip1 提交成功！
					.qtip2 感谢您提出的宝贵建议。
					.qtip3
						.nfc 温馨提示：
						div 1、抱歉我们还不能对您的建议进行逐一回复；
						div 2、我们处理后会通过广发网消息及时提醒您。
					button.comment-btn(ng-click='$parent.opened=false;$parent.success=false;') 确定

//- 右侧浮动
mixin floatKefu()
	.floatKefu
		.floatTop
			.floatClose
			.floatToggle
		.floatCon
			a.floatBlock(href="https://account.gf.com.cn/osoa/views/index.html?r=0.2732206245418638", target="wykh")
				.floatWrap.kaihuInternet 网上开户
				.floatErweima.kaihuPCMa 创新视频验证，谈笑间，证券账<br>户为您在线开通！
			a.floatBlock(href="https://store.gf.com.cn/mobile/static/mobile-account/mobile-account.html", target="wykh")
				.floatWrap.kaihuMobile 掌上开户
				.floatErweima.kaihuMobileMa 十分钟内快速开户，助您轻松驰<br>骋资本市场，遨游股海风云！
			a.floatBlock(href="http://store.gf.com.cn/download/index.html", target="wykh")
				.floatWrap.zhengquanMoblie 手机证券
				.floatErweima.zhengquanMoblieMa 全新的界面，丰富的资讯，高收<br>益的产品，尽在手机证券！
			a.floatBlock(href="http://store.gf.com.cn/weixin/index.html", target="wykh")
				.floatWrap.wechatGuanfang 官方微信
				.floatErweima.wechatGuanfangMa 原来资讯可以这样看，行情可以<br>这样问，服务可以这样做！
		.zhanwei
		a.floatBot(href="http://store.gf.com.cn/im/desktop?channel=e-trade", target="_imService") 有问必答
		a.topBtn#back-to-top(href="javascript:;", ng-click="top()")
